import Vue from 'vue';
import {getSession} from '@/api/storage';
let lifeData = []

// 是否有权限
const hasMenuPermission = userPermission => {
  if(!userPermission) return true
	try{
		lifeData = getSession('authList');
	}catch(e){}
  let userPermissionList = Array.isArray(userPermission) ? userPermission : [userPermission];
  return userPermissionList.some(e => lifeData.includes(e));
};


// 全局判断方法
Vue.prototype.$_auth = hasMenuPermission;

